<?php
$host = "0.0.0.0";
$port = 9501;
$ws = new swoole_websocket_server($host,$port);
$ws->on('open',function($ws,$request){
    var_dump($request);
    $ws->push($request->fd,"welcome \n");
});
$ws->on('message',function($ws,$request){
    echo "Message: $request->data";
    $ws->push($request->fd,"get the message");
});
$ws->on('close',function($ws,$request){
    echo "close";
});
$ws->start();